home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / pdox693.zip / TI163.ASC < prev    next >
Text File  |  1992-08-12  |  10KB  |  397 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Paradox                                NUMBER  :  163
  9.   VERSION  :  2.0 & up
  10.        OS  :  DOS
  11.      DATE  :  August 12, 1992                          PAGE  :  1/6
  12.  
  13.     TITLE  :  How to Create a Secondary Index
  14.  
  15.  
  16.  
  17.  
  18.   The purpose of this Technical Information Sheet is to provide an
  19.   explanation of how to establish secondary indexes on Paradox
  20.   tables in order to speed up certain operations.  This document
  21.   will present alternative methods for the creation of secondary
  22.   indexes and the ways they can be used most effectively.
  23.  
  24.   A secondary index is an index on any field in a table, whether it
  25.   is a primary key field or not.  Paradox also calls a secondary
  26.   index a QUERY-SPEEDUP or a SPEEDUP FILE.
  27.  
  28.   Secondary indexes are used to speed up the following Paradox
  29.   operations:
  30.  
  31.       o  Queries
  32.  
  33.       o  The Image | Zoom | Value command
  34.  
  35.       o  Zoom <Ctl-Z> and Zoom Next <Alt-Z>
  36.  
  37.       o  The PAL LOCATE command
  38.  
  39.   CHARACTERISTICS OF SECONDARY INDEXES
  40.  
  41.       o  There can be MANY secondary indexes for a table: one for
  42.          each field.
  43.  
  44.       o  ANY field can have a secondary index.
  45.  
  46.       o  Secondary indexes have NO affect on the sort order of the
  47.          table.
  48.  
  49.       o  There is no uniqueness requirement for secondary index
  50.          values.
  51.  
  52.       o  Paradox DOES NOT support multi-field secondary indexes;
  53.          only single-field indexes.
  54.  
  55.   HOW TO CREATE A SECONDARY INDEX
  56.  
  57.   There are two ways to create a secondary index:
  58.  
  59.       o  Interactively using  QuerySpeed
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  Paradox                                NUMBER  :  163
  75.   VERSION  :  2.0 & up
  76.        OS  :  DOS
  77.      DATE  :  August 12, 1992                          PAGE  :  2/6
  78.  
  79.     TITLE  : How to Create a Secondary Index.
  80.  
  81.  
  82.  
  83.  
  84.       o  Using the PAL INDEX command
  85.  
  86.   INTERACTIVE METHOD
  87.  
  88.         I.  Set up a query for the table in question and enter a
  89.             criterion in the field you want to index on.  As an
  90.             example; by entering the selection criterion of "Smith"
  91.             in the Last Name field of the query for the Customer
  92.             table.
  93.  
  94.        II.  Bring up the main menu by pressing <F-10> and select
  95.             Tools | Queryspeed.  Paradox does not actually do the
  96.             query.  Instead, it inspects the query and determines
  97.             if building an index would make the query faster.  In
  98.             our example above, the program would create an index on
  99.             the Last Name field.
  100.  
  101.       III.  Shortcomings of the INTERACTIVE method:
  102.  
  103.             A. Paradox decides whether a field merits an index.
  104.  
  105.             B. For many queries, the Tools | QuerySpeed command
  106.             presents the message,  No speedup possible.
  107.  
  108.   PAL INDEX COMMAND METHOD
  109.  
  110.         I.  View the table in question and move the cursor to the
  111.             field that you want the index on.
  112.  
  113.        II.  Press the <Alt-F10> key.  This will display what is
  114.             known as the "PAL Menu".
  115.  
  116.       III.  Select | Miniscript.
  117.  
  118.        IV.  Paradox will ask you to type in a command at the top of
  119.             the screen.
  120.  
  121.         V.  Type in the following line, exactly as seen here (upper
  122.             and lower case are not important), and press the
  123.             <Enter> key:
  124.  
  125.             INDEX TABLE() ON FIELD()
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.   PRODUCT  :  Paradox                                NUMBER  :  163
  141.   VERSION  :  2.0 & up
  142.        OS  :  DOS
  143.      DATE  :  August 12, 1992                          PAGE  :  3/6
  144.  
  145.     TITLE  : How to Create a Secondary Index.
  146.  
  147.  
  148.  
  149.  
  150.        VI.  When you press the <Enter> key, your screen will not
  151.             change for some period of time while Paradox builds the
  152.             index.  As long as your disk drive light is on, the
  153.             program is still working on it.
  154.  
  155.       VII.  Explanation of the PAL command:
  156.  
  157.             INDEX -- the command to the program to build a
  158.             secondary index
  159.             file.
  160.  
  161.             TABLE() -- means "the current table"
  162.  
  163.             FIELD() -- means "the current field"
  164.  
  165.             Alternative PAL command:
  166.  
  167.             INDEX "Customer" on "Last name"
  168.  
  169.      VIII.  Be sure to spell correctly and put quotes around, the
  170.             table name and field name.
  171.  
  172.        IX.  If an index already exists, the INDEX command deletes
  173.             the old index and builds a new one, unconditionally.
  174.  
  175.   MAINTAINED AND NON-MAINTAINED SECONDARY INDEXES
  176.  
  177.   Secondary indexes come in two varieties: maintained and non-
  178.   maintained.  The differences between the two is what happens when
  179.   editing the table.
  180.  
  181.   With a MAINTAINED index:
  182.  
  183.   Paradox immediately updates the index to reflect the change.
  184.  
  185.   With a NON-MAINTAINED index:
  186.  
  187.   The index is not updated.
  188.  
  189.   Paradox marks it as "Not Current".
  190.  
  191.   Paradox rebuilds it the next time it goes to use it.  This
  192.   process can substantially slow down the above mentioned
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.   PRODUCT  :  Paradox                                NUMBER  :  163
  207.   VERSION  :  2.0 & up
  208.        OS  :  DOS
  209.      DATE  :  August 12, 1992                          PAGE  :  4/6
  210.  
  211.     TITLE  : How to Create a Secondary Index.
  212.  
  213.  
  214.  
  215.  
  216.   operations.  With this in mind, MAINTAINED indexes are almost
  217.   always better.
  218.  
  219.   HOW TO CREATE A MAINTAINED SECONDARY INDEX
  220.  
  221.   THE PAL INDEX COMMAND METHOD
  222.  
  223.         I.  Use the same instructions as earlier, but add the word
  224.             MAINTAINED after the word INDEX:
  225.  
  226.             INDEX MAINTAINED TABLE() ON FIELD()
  227.               or
  228.             INDEX MAINTAINED "CUSTOMER" ON "LAST NAME"
  229.  
  230.   THE QUERYSPEED METHOD:
  231.  
  232.         I.  No direct way to specify "maintained" or non-
  233.             maintained.
  234.  
  235.        II.  In the Custom Configuration Program, a global
  236.             preference can be set.  Use the menu option PAL |
  237.             MaintainedIndexes in the
  238.             Custom Script Menu.
  239.  
  240.             -- set to YES for maintained.
  241.  
  242.             -- set to NO  for non-maintained.
  243.  
  244.       III.  Note: The use of the MaintainIndexes selection in the
  245.             PAL menu of the Custom Script is a limited option.  In
  246.             fact, it has nothing to do with PAL.  This function
  247.             does not have any effect on the PAL INDEX command.  It
  248.             only effects indexes created interactively with the
  249.             Tools | Queryspeed menu choice.
  250.  
  251.   MAINTAINED INDEXES AND EDITING TABLES
  252.  
  253.   If changes are made to a table in EDIT mode using the <F9> key:
  254.  
  255.         I.  Paradox delays updating the index until the <F2> key is
  256.             pressed.
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.   PRODUCT  :  Paradox                                NUMBER  :  163
  273.   VERSION  :  2.0 & up
  274.        OS  :  DOS
  275.      DATE  :  August 12, 1992                          PAGE  :  5/6
  276.  
  277.     TITLE  : How to Create a Secondary Index.
  278.  
  279.  
  280.  
  281.  
  282.        II.  Meanwhile, Paradox marks the index as "temporarily not
  283.             current."
  284.  
  285.       III.  If Zoom (<CTL-Z> is used on a field, Paradox will not
  286.             use the index and the search will be slow.
  287.  
  288.   If changes are made while in COEDIT mode using the <ALT-F9 key>:
  289.  
  290.         I.  Paradox keeps all the maintained indexes up-to-date
  291.             after each record.
  292.  
  293.        II.  Zooms on indexed fields will continue to be fast.
  294.  
  295.       III.  In general terms; it is better to use COEDIT mode when
  296.             working with indexed tables although the ability to use
  297.             full incremental undos is lost.  While in COEDIT mode
  298.             UNDO <CTL-U> will only undo the most recent change
  299.             made.
  300.  
  301.   PATTERN SEARCHES
  302.  
  303.         I.  For queries, Paradox does not use an index to enhance
  304.             the performance of a criteria with a pattern.
  305.  
  306.        II.  For zooms (and LOCATE PATTERN), a pattern is used only
  307.             if the string does not begin with a pattern e.g.
  308.  
  309.                    "smi.."  will be fast.
  310.  
  311.                    "..ith"  will not be.
  312.  
  313.       III.  A pattern search is not case sensitive.
  314.  
  315.                    "smi.." will match smi, SMI, Smi, sMI, etc.
  316.  
  317.        IV.  Paradox uses the index to match only the first letter
  318.             of the pattern,  It then performs a sequential search
  319.             from there.  If many values start with the same letter,
  320.             an index will not help pattern zooms.
  321.  
  322.   HOW TO IDENTIFY INDEX FILES
  323.  
  324.   File name extensions
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.   PRODUCT  :  Paradox                                NUMBER  :  163
  339.   VERSION  :  2.0 & up
  340.        OS  :  DOS
  341.      DATE  :  August 12, 1992                          PAGE  :  6/6
  342.  
  343.     TITLE  : How to Create a Secondary Index.
  344.  
  345.  
  346.  
  347.  
  348.   .DB -- the table's data
  349.  
  350.   .PX -- the table's primary index
  351.  
  352.   .Xnn or .Ynn -- secondary index
  353.   (The "nn" will be a hexadecimal number from 01 through FF.)
  354.  
  355.   ADDITIONAL INFORMATION CONCERNING SECONDARY INDEXES
  356.  
  357.       o  Indexing tables, pages 183-185 and pages 296-298 in the
  358.          PAL User's Guide (3.5).
  359.  
  360.       o  Indexing tables, pages 277-278 in the Paradox User's Guide
  361.          (3.5).
  362.  
  363.       o  In the PAL User's Guide and Paradox User's Guide, look in
  364.          the index under "Index"  for more information.
  365.  
  366.   (This Technical Information Sheet is based on material by Brian
  367.   J. Smith and Associates Inc.)
  368.  
  369.   DISCLAIMER: You have the right to use this technical information
  370.   subject to the terms of the No-Nonsense License Statement that
  371.   you received with the Borland product to which this information
  372.   pertains.
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.